#pragma once
// MESSAGE MISSION_CMD PACKING

#define MAVLINK_MSG_ID_MISSION_CMD 12923


typedef struct __mavlink_mission_cmd_t {
 int64_t seq; /*<  seq序列号*/
 double param_float[8]; /*<  浮点型参数*/
 int32_t cmd; /*<  指令*/
 int32_t param_int[8]; /*<  整型参数*/
 uint8_t drone_type; /*<  飞机类型 DroneType*/
 uint8_t drone_id; /*<  飞机id*/
 char param_str[64]; /*<  字符型参数*/
} mavlink_mission_cmd_t;

#define MAVLINK_MSG_ID_MISSION_CMD_LEN 174
#define MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN 174
#define MAVLINK_MSG_ID_12923_LEN 174
#define MAVLINK_MSG_ID_12923_MIN_LEN 174

#define MAVLINK_MSG_ID_MISSION_CMD_CRC 99
#define MAVLINK_MSG_ID_12923_CRC 99

#define MAVLINK_MSG_MISSION_CMD_FIELD_PARAM_FLOAT_LEN 8
#define MAVLINK_MSG_MISSION_CMD_FIELD_PARAM_INT_LEN 8
#define MAVLINK_MSG_MISSION_CMD_FIELD_PARAM_STR_LEN 64

#if MAVLINK_COMMAND_24BIT
#define MAVLINK_MESSAGE_INFO_MISSION_CMD { \
    12923, \
    "MISSION_CMD", \
    7, \
    {  { "seq", NULL, MAVLINK_TYPE_INT64_T, 0, 0, offsetof(mavlink_mission_cmd_t, seq) }, \
         { "drone_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 108, offsetof(mavlink_mission_cmd_t, drone_type) }, \
         { "drone_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 109, offsetof(mavlink_mission_cmd_t, drone_id) }, \
         { "cmd", NULL, MAVLINK_TYPE_INT32_T, 0, 72, offsetof(mavlink_mission_cmd_t, cmd) }, \
         { "param_int", NULL, MAVLINK_TYPE_INT32_T, 8, 76, offsetof(mavlink_mission_cmd_t, param_int) }, \
         { "param_float", NULL, MAVLINK_TYPE_DOUBLE, 8, 8, offsetof(mavlink_mission_cmd_t, param_float) }, \
         { "param_str", NULL, MAVLINK_TYPE_CHAR, 64, 110, offsetof(mavlink_mission_cmd_t, param_str) }, \
         } \
}
#else
#define MAVLINK_MESSAGE_INFO_MISSION_CMD { \
    "MISSION_CMD", \
    7, \
    {  { "seq", NULL, MAVLINK_TYPE_INT64_T, 0, 0, offsetof(mavlink_mission_cmd_t, seq) }, \
         { "drone_type", NULL, MAVLINK_TYPE_UINT8_T, 0, 108, offsetof(mavlink_mission_cmd_t, drone_type) }, \
         { "drone_id", NULL, MAVLINK_TYPE_UINT8_T, 0, 109, offsetof(mavlink_mission_cmd_t, drone_id) }, \
         { "cmd", NULL, MAVLINK_TYPE_INT32_T, 0, 72, offsetof(mavlink_mission_cmd_t, cmd) }, \
         { "param_int", NULL, MAVLINK_TYPE_INT32_T, 8, 76, offsetof(mavlink_mission_cmd_t, param_int) }, \
         { "param_float", NULL, MAVLINK_TYPE_DOUBLE, 8, 8, offsetof(mavlink_mission_cmd_t, param_float) }, \
         { "param_str", NULL, MAVLINK_TYPE_CHAR, 64, 110, offsetof(mavlink_mission_cmd_t, param_str) }, \
         } \
}
#endif

/**
 * @brief Pack a mission_cmd message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 *
 * @param seq  seq序列号
 * @param drone_type  飞机类型 DroneType
 * @param drone_id  飞机id
 * @param cmd  指令
 * @param param_int  整型参数
 * @param param_float  浮点型参数
 * @param param_str  字符型参数
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_mission_cmd_pack(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg,
                               int64_t seq, uint8_t drone_type, uint8_t drone_id, int32_t cmd, const int32_t *param_int, const double *param_float, const char *param_str)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_MISSION_CMD_LEN];
    _mav_put_int64_t(buf, 0, seq);
    _mav_put_int32_t(buf, 72, cmd);
    _mav_put_uint8_t(buf, 108, drone_type);
    _mav_put_uint8_t(buf, 109, drone_id);
    _mav_put_double_array(buf, 8, param_float, 8);
    _mav_put_int32_t_array(buf, 76, param_int, 8);
    _mav_put_char_array(buf, 110, param_str, 64);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CMD_LEN);
#else
    mavlink_mission_cmd_t packet;
    packet.seq = seq;
    packet.cmd = cmd;
    packet.drone_type = drone_type;
    packet.drone_id = drone_id;
    mav_array_memcpy(packet.param_float, param_float, sizeof(double)*8);
    mav_array_memcpy(packet.param_int, param_int, sizeof(int32_t)*8);
    mav_array_memcpy(packet.param_str, param_str, sizeof(char)*64);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CMD_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_MISSION_CMD;
    return mavlink_finalize_message(msg, system_id, component_id, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN, MAVLINK_MSG_ID_MISSION_CMD_CRC);
}

/**
 * @brief Pack a mission_cmd message
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param status MAVLink status structure
 * @param msg The MAVLink message to compress the data into
 *
 * @param seq  seq序列号
 * @param drone_type  飞机类型 DroneType
 * @param drone_id  飞机id
 * @param cmd  指令
 * @param param_int  整型参数
 * @param param_float  浮点型参数
 * @param param_str  字符型参数
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_mission_cmd_pack_status(uint8_t system_id, uint8_t component_id, mavlink_status_t *_status, mavlink_message_t* msg,
                               int64_t seq, uint8_t drone_type, uint8_t drone_id, int32_t cmd, const int32_t *param_int, const double *param_float, const char *param_str)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_MISSION_CMD_LEN];
    _mav_put_int64_t(buf, 0, seq);
    _mav_put_int32_t(buf, 72, cmd);
    _mav_put_uint8_t(buf, 108, drone_type);
    _mav_put_uint8_t(buf, 109, drone_id);
    _mav_put_double_array(buf, 8, param_float, 8);
    _mav_put_int32_t_array(buf, 76, param_int, 8);
    _mav_put_char_array(buf, 110, param_str, 64);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CMD_LEN);
#else
    mavlink_mission_cmd_t packet;
    packet.seq = seq;
    packet.cmd = cmd;
    packet.drone_type = drone_type;
    packet.drone_id = drone_id;
    mav_array_memcpy(packet.param_float, param_float, sizeof(double)*8);
    mav_array_memcpy(packet.param_int, param_int, sizeof(int32_t)*8);
    mav_array_memcpy(packet.param_str, param_str, sizeof(char)*64);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CMD_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_MISSION_CMD;
#if MAVLINK_CRC_EXTRA
    return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN, MAVLINK_MSG_ID_MISSION_CMD_CRC);
#else
    return mavlink_finalize_message_buffer(msg, system_id, component_id, _status, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN);
#endif
}

/**
 * @brief Pack a mission_cmd message on a channel
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param seq  seq序列号
 * @param drone_type  飞机类型 DroneType
 * @param drone_id  飞机id
 * @param cmd  指令
 * @param param_int  整型参数
 * @param param_float  浮点型参数
 * @param param_str  字符型参数
 * @return length of the message in bytes (excluding serial stream start sign)
 */
static inline uint16_t mavlink_msg_mission_cmd_pack_chan(uint8_t system_id, uint8_t component_id, uint8_t chan,
                               mavlink_message_t* msg,
                                   int64_t seq,uint8_t drone_type,uint8_t drone_id,int32_t cmd,const int32_t *param_int,const double *param_float,const char *param_str)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_MISSION_CMD_LEN];
    _mav_put_int64_t(buf, 0, seq);
    _mav_put_int32_t(buf, 72, cmd);
    _mav_put_uint8_t(buf, 108, drone_type);
    _mav_put_uint8_t(buf, 109, drone_id);
    _mav_put_double_array(buf, 8, param_float, 8);
    _mav_put_int32_t_array(buf, 76, param_int, 8);
    _mav_put_char_array(buf, 110, param_str, 64);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), buf, MAVLINK_MSG_ID_MISSION_CMD_LEN);
#else
    mavlink_mission_cmd_t packet;
    packet.seq = seq;
    packet.cmd = cmd;
    packet.drone_type = drone_type;
    packet.drone_id = drone_id;
    mav_array_memcpy(packet.param_float, param_float, sizeof(double)*8);
    mav_array_memcpy(packet.param_int, param_int, sizeof(int32_t)*8);
    mav_array_memcpy(packet.param_str, param_str, sizeof(char)*64);
        memcpy(_MAV_PAYLOAD_NON_CONST(msg), &packet, MAVLINK_MSG_ID_MISSION_CMD_LEN);
#endif

    msg->msgid = MAVLINK_MSG_ID_MISSION_CMD;
    return mavlink_finalize_message_chan(msg, system_id, component_id, chan, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN, MAVLINK_MSG_ID_MISSION_CMD_CRC);
}

/**
 * @brief Encode a mission_cmd struct
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param msg The MAVLink message to compress the data into
 * @param mission_cmd C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_mission_cmd_encode(uint8_t system_id, uint8_t component_id, mavlink_message_t* msg, const mavlink_mission_cmd_t* mission_cmd)
{
    return mavlink_msg_mission_cmd_pack(system_id, component_id, msg, mission_cmd->seq, mission_cmd->drone_type, mission_cmd->drone_id, mission_cmd->cmd, mission_cmd->param_int, mission_cmd->param_float, mission_cmd->param_str);
}

/**
 * @brief Encode a mission_cmd struct on a channel
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param chan The MAVLink channel this message will be sent over
 * @param msg The MAVLink message to compress the data into
 * @param mission_cmd C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_mission_cmd_encode_chan(uint8_t system_id, uint8_t component_id, uint8_t chan, mavlink_message_t* msg, const mavlink_mission_cmd_t* mission_cmd)
{
    return mavlink_msg_mission_cmd_pack_chan(system_id, component_id, chan, msg, mission_cmd->seq, mission_cmd->drone_type, mission_cmd->drone_id, mission_cmd->cmd, mission_cmd->param_int, mission_cmd->param_float, mission_cmd->param_str);
}

/**
 * @brief Encode a mission_cmd struct with provided status structure
 *
 * @param system_id ID of this system
 * @param component_id ID of this component (e.g. 200 for IMU)
 * @param status MAVLink status structure
 * @param msg The MAVLink message to compress the data into
 * @param mission_cmd C-struct to read the message contents from
 */
static inline uint16_t mavlink_msg_mission_cmd_encode_status(uint8_t system_id, uint8_t component_id, mavlink_status_t* _status, mavlink_message_t* msg, const mavlink_mission_cmd_t* mission_cmd)
{
    return mavlink_msg_mission_cmd_pack_status(system_id, component_id, _status, msg,  mission_cmd->seq, mission_cmd->drone_type, mission_cmd->drone_id, mission_cmd->cmd, mission_cmd->param_int, mission_cmd->param_float, mission_cmd->param_str);
}

/**
 * @brief Send a mission_cmd message
 * @param chan MAVLink channel to send the message
 *
 * @param seq  seq序列号
 * @param drone_type  飞机类型 DroneType
 * @param drone_id  飞机id
 * @param cmd  指令
 * @param param_int  整型参数
 * @param param_float  浮点型参数
 * @param param_str  字符型参数
 */
#ifdef MAVLINK_USE_CONVENIENCE_FUNCTIONS

static inline void mavlink_msg_mission_cmd_send(mavlink_channel_t chan, int64_t seq, uint8_t drone_type, uint8_t drone_id, int32_t cmd, const int32_t *param_int, const double *param_float, const char *param_str)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char buf[MAVLINK_MSG_ID_MISSION_CMD_LEN];
    _mav_put_int64_t(buf, 0, seq);
    _mav_put_int32_t(buf, 72, cmd);
    _mav_put_uint8_t(buf, 108, drone_type);
    _mav_put_uint8_t(buf, 109, drone_id);
    _mav_put_double_array(buf, 8, param_float, 8);
    _mav_put_int32_t_array(buf, 76, param_int, 8);
    _mav_put_char_array(buf, 110, param_str, 64);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CMD, buf, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN, MAVLINK_MSG_ID_MISSION_CMD_CRC);
#else
    mavlink_mission_cmd_t packet;
    packet.seq = seq;
    packet.cmd = cmd;
    packet.drone_type = drone_type;
    packet.drone_id = drone_id;
    mav_array_memcpy(packet.param_float, param_float, sizeof(double)*8);
    mav_array_memcpy(packet.param_int, param_int, sizeof(int32_t)*8);
    mav_array_memcpy(packet.param_str, param_str, sizeof(char)*64);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CMD, (const char *)&packet, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN, MAVLINK_MSG_ID_MISSION_CMD_CRC);
#endif
}

/**
 * @brief Send a mission_cmd message
 * @param chan MAVLink channel to send the message
 * @param struct The MAVLink struct to serialize
 */
static inline void mavlink_msg_mission_cmd_send_struct(mavlink_channel_t chan, const mavlink_mission_cmd_t* mission_cmd)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mavlink_msg_mission_cmd_send(chan, mission_cmd->seq, mission_cmd->drone_type, mission_cmd->drone_id, mission_cmd->cmd, mission_cmd->param_int, mission_cmd->param_float, mission_cmd->param_str);
#else
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CMD, (const char *)mission_cmd, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN, MAVLINK_MSG_ID_MISSION_CMD_CRC);
#endif
}

#if MAVLINK_MSG_ID_MISSION_CMD_LEN <= MAVLINK_MAX_PAYLOAD_LEN
/*
  This variant of _send() can be used to save stack space by re-using
  memory from the receive buffer.  The caller provides a
  mavlink_message_t which is the size of a full mavlink message. This
  is usually the receive buffer for the channel, and allows a reply to an
  incoming message with minimum stack space usage.
 */
static inline void mavlink_msg_mission_cmd_send_buf(mavlink_message_t *msgbuf, mavlink_channel_t chan,  int64_t seq, uint8_t drone_type, uint8_t drone_id, int32_t cmd, const int32_t *param_int, const double *param_float, const char *param_str)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    char *buf = (char *)msgbuf;
    _mav_put_int64_t(buf, 0, seq);
    _mav_put_int32_t(buf, 72, cmd);
    _mav_put_uint8_t(buf, 108, drone_type);
    _mav_put_uint8_t(buf, 109, drone_id);
    _mav_put_double_array(buf, 8, param_float, 8);
    _mav_put_int32_t_array(buf, 76, param_int, 8);
    _mav_put_char_array(buf, 110, param_str, 64);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CMD, buf, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN, MAVLINK_MSG_ID_MISSION_CMD_CRC);
#else
    mavlink_mission_cmd_t *packet = (mavlink_mission_cmd_t *)msgbuf;
    packet->seq = seq;
    packet->cmd = cmd;
    packet->drone_type = drone_type;
    packet->drone_id = drone_id;
    mav_array_memcpy(packet->param_float, param_float, sizeof(double)*8);
    mav_array_memcpy(packet->param_int, param_int, sizeof(int32_t)*8);
    mav_array_memcpy(packet->param_str, param_str, sizeof(char)*64);
    _mav_finalize_message_chan_send(chan, MAVLINK_MSG_ID_MISSION_CMD, (const char *)packet, MAVLINK_MSG_ID_MISSION_CMD_MIN_LEN, MAVLINK_MSG_ID_MISSION_CMD_LEN, MAVLINK_MSG_ID_MISSION_CMD_CRC);
#endif
}
#endif

#endif

// MESSAGE MISSION_CMD UNPACKING


/**
 * @brief Get field seq from mission_cmd message
 *
 * @return  seq序列号
 */
static inline int64_t mavlink_msg_mission_cmd_get_seq(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int64_t(msg,  0);
}

/**
 * @brief Get field drone_type from mission_cmd message
 *
 * @return  飞机类型 DroneType
 */
static inline uint8_t mavlink_msg_mission_cmd_get_drone_type(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  108);
}

/**
 * @brief Get field drone_id from mission_cmd message
 *
 * @return  飞机id
 */
static inline uint8_t mavlink_msg_mission_cmd_get_drone_id(const mavlink_message_t* msg)
{
    return _MAV_RETURN_uint8_t(msg,  109);
}

/**
 * @brief Get field cmd from mission_cmd message
 *
 * @return  指令
 */
static inline int32_t mavlink_msg_mission_cmd_get_cmd(const mavlink_message_t* msg)
{
    return _MAV_RETURN_int32_t(msg,  72);
}

/**
 * @brief Get field param_int from mission_cmd message
 *
 * @return  整型参数
 */
static inline uint16_t mavlink_msg_mission_cmd_get_param_int(const mavlink_message_t* msg, int32_t *param_int)
{
    return _MAV_RETURN_int32_t_array(msg, param_int, 8,  76);
}

/**
 * @brief Get field param_float from mission_cmd message
 *
 * @return  浮点型参数
 */
static inline uint16_t mavlink_msg_mission_cmd_get_param_float(const mavlink_message_t* msg, double *param_float)
{
    return _MAV_RETURN_double_array(msg, param_float, 8,  8);
}

/**
 * @brief Get field param_str from mission_cmd message
 *
 * @return  字符型参数
 */
static inline uint16_t mavlink_msg_mission_cmd_get_param_str(const mavlink_message_t* msg, char *param_str)
{
    return _MAV_RETURN_char_array(msg, param_str, 64,  110);
}

/**
 * @brief Decode a mission_cmd message into a struct
 *
 * @param msg The message to decode
 * @param mission_cmd C-struct to decode the message contents into
 */
static inline void mavlink_msg_mission_cmd_decode(const mavlink_message_t* msg, mavlink_mission_cmd_t* mission_cmd)
{
#if MAVLINK_NEED_BYTE_SWAP || !MAVLINK_ALIGNED_FIELDS
    mission_cmd->seq = mavlink_msg_mission_cmd_get_seq(msg);
    mavlink_msg_mission_cmd_get_param_float(msg, mission_cmd->param_float);
    mission_cmd->cmd = mavlink_msg_mission_cmd_get_cmd(msg);
    mavlink_msg_mission_cmd_get_param_int(msg, mission_cmd->param_int);
    mission_cmd->drone_type = mavlink_msg_mission_cmd_get_drone_type(msg);
    mission_cmd->drone_id = mavlink_msg_mission_cmd_get_drone_id(msg);
    mavlink_msg_mission_cmd_get_param_str(msg, mission_cmd->param_str);
#else
        uint8_t len = msg->len < MAVLINK_MSG_ID_MISSION_CMD_LEN? msg->len : MAVLINK_MSG_ID_MISSION_CMD_LEN;
        memset(mission_cmd, 0, MAVLINK_MSG_ID_MISSION_CMD_LEN);
    memcpy(mission_cmd, _MAV_PAYLOAD(msg), len);
#endif
}
